//
//  MiniMusicControlViewViewController.m
//  One
//
//  Created by mac on 16/6/3.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "MiniMusicControlViewViewController.h"
#import "MusicPlay.h"

@interface MiniMusicControlViewViewController ()
{
    MusicPlay *play ;
}
@end

static MiniMusicControlViewViewController *miniVC = nil;

@implementation MiniMusicControlViewViewController

+ (id)shareMiniVC
{
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        miniVC = [[super allocWithZone:NULL] init] ;
    });
    return miniVC;
}

+ (id)allocWithZone:(struct _NSZone *)zone
{
    return [self shareMiniVC];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    play = [MusicPlay shareAVPlay];

    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    _musicName.text = _showObj.title;
    _musicion.text = _showObj.author_user_name;
    
    if (play.isPlaying) {
        _playMusicButton.selected = YES;
    }
    else
        _playMusicButton.selected = NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view removeFromSuperview];
}

- (IBAction)playButtonClick:(id)sender {
    UIButton *playButton = (UIButton *)sender;
    playButton.selected = !playButton.selected;
    [play doPlay];
}

- (IBAction)frontButtonClick:(id)sender {
//    UIButton *front = (UIButton *)sender;
    
    
}

- (IBAction)nextButtonClick:(id)sender {
//    UIButton *next = (UIButton *)sender;
    [play playDidEnd];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
